package atlantik.ui;

import java.awt.BorderLayout;
import javax.swing.JPanel;

import atlantik.game.Atlantik;

public class ConnectedState implements GUIState {

	private final GameList games;
	private final GameChooser gameChooser;
        private final JPanel cPane;
	
	public ConnectedState(Atlantik client) {
		games = new GameList(client);
		gameChooser = new GameChooser(client);
                cPane = new JPanel();
	}

//        Steven Grier: July 1, 2008 
//                Reorganized join game GUI to make it more intuitive and user friendly
//                    * added CPane
//                    * used border layout
	public void begin(GUI gui) {
//		gui.add(games);
//		gui.add(gameChooser, BorderLayout.SOUTH);
                cPane.setLayout(new BorderLayout());
                cPane.add(games);
                cPane.add(gameChooser, BorderLayout.SOUTH);
                gui.add(cPane);
	}

	public void end(GUI gui) {
//		gui.remove(games);
//		gui.remove(gameChooser);
                gui.remove(cPane);
	}

}
